#include<iostream>
#include <vector>
using namespace std;
#define ok 1
#define error -1
void Print(const vector<int>& v) {
	cout << v.size() << ' ';
	for (int i = 0; i < v.size(); i++) {
		cout << v[i] << ' '; 
	}
	cout << endl;
}
void Insert(vector<int>& v, int pos, int x) {
	
	if (pos <= 0 || pos > v.size()) {
		cout << "error" << endl;
	}
	else
	{
		//v.insert(v.begin()+pos - 1, x);
		v.resize(v.size() + 1);
		for (int i = v.size() - 1; i > pos - 1; i--) {
			v[i] = v[i - 1];
		}
		v[pos - 1] = x;
		Print(v);
	}
}

void Pop(vector<int>& v, int pos) {
	if (pos <= 0 || pos > v.size()) {
		cout << "error" << endl;
	}
	else
	{
		//v.erase(v.begin() + pos - 1);
		for (int i = pos - 1; i < v.size() - 1; i++) {
			v[i] = v[i + 1];
		}
		v.pop_back();
		Print(v);
	}
}
void Find(vector<int>& v, int pos) {
	if (pos <= 0 || pos > v.size()) {
		cout << "error" << endl;
	}
	else
	{
		cout << v[pos - 1] << endl;
	}
}

int main() {
	int n;
	cin >> n;
	//int* arr = new int[n];
	vector<int> v;
	int tmp = 0;
	for (int i = 0; i < n; i++){
		cin >> tmp;
		v.push_back(tmp);
	}
	Print(v);
	int pos;

	cin >> pos>>n;
	Insert(v, pos,n);

	cin >>pos>> n;
	Insert(v, pos, n);

	cin >> n;
	Pop(v, n);

	cin >> n;
	Pop(v, n);

	cin >> n;
	Find(v, n);

	cin >> n;
	Find(v, n);

	return 0;
}